const { defineConfig } = require("@vue/cli-service");
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");

module.exports = defineConfig({
  transpileDependencies: true,
  chainWebpack(config) {
    config.plugin("monaco").use(new MonacoWebpackPlugin());

    config.module
      .rule("js")
      .test(/\.js$/)
      .exclude.add(
        (filepath) =>
          filepath.includes("node_modules") &&
          !filepath.includes("monaco-editor") &&
          !filepath.includes("md-editor-v3")
      )
      .end()
      .use("babel-loader")
      .loader("babel-loader")
      .options({
        presets: ["@babel/preset-env"],
        plugins: [
          "@babel/plugin-proposal-class-properties",
          "@babel/plugin-proposal-private-methods",
          "@babel/plugin-transform-private-methods",
        ],
      });
  },
});
